package cn.hbu.zlfw.redirect.controller;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.hbu.zlfw.dic.entity.DicUserType;
import cn.hbu.zlfw.dic.service.DicUserTypeService;
/**
 * @ClassName: RedirectController 
 * @Description: 页面转发控制器
 * @author 王鹏伟<1223443289@qq.com>
 * @date 2017年10月24日 上午11:25:01  
 * @version V1.0
 */
@Controller("redirectController")
@RequestMapping("/redirect")
public class RedirectController {
	/**
	 * 日志
	 */
	public final Logger logger=LoggerFactory.getLogger(RedirectController.class);
	
	@Autowired
	private DicUserTypeService dicUserTypeService;
	/**
	 * 
	 * @Title: toLogin 
	 * @Description: TODO
	 * @return  进入前台登录页面
	 * @return String   
	 * @throws
	 */
	@RequestMapping("/index.html")
	public String toLogin() {
		return "forward:admin/login.jsp";
	}
	/**
	 * 
	 * @Title: to404error 
	 * @Description: 转向404错误页面
	 * @return String 
	 * @throws
	 */
	@RequestMapping("/404error.html")
	public String to404error() {
		return "forward:/error/404.jsp";
	}
	/**
	/**
	 * @Title: toForgetPassword 
	 * @Description: 转发到忘记密码页面
	 * @return String   
	 * @throws
	 */
	@RequestMapping("/toForget.html")
	public String toForgetPassword(ModelMap map){
		//返回所有用户类型
		List<DicUserType> tempdicUserTypes = dicUserTypeService.findAll();
		List<DicUserType> dicUserTypes = new ArrayList<DicUserType>();
		for (DicUserType dicUserType : tempdicUserTypes) {
			dicUserTypes.add(dicUserType);
		}
		map.addAttribute("dicUserTypes", dicUserTypes);
		map.addAttribute("name", "HRX");
		return "forget/forget";
	}
}
